<template>
<div>
  <van-icon name="arrow-left" size="30" @click="$router.push('/Article')" />
 <van-nav-bar title="短信登录" class="duanxing" />
<van-form @submit="onSubmit">
  <van-field
    v-model="username"
    placeholder="手机号"
    :rules="[{ required: true, message: '请输入11位手机号' }]"
  />

  <van-field
    v-model="password"
    placeholder="请输入验证码"
    label="短信验证"
    :rules="[{ required: true, message: '请输入六位验证码' }]"
  />
  <span>短信验证</span>
  <div style="margin: 16px;">
    <van-button round block type="info" native-type="submit" @click='add'>登录</van-button>
  </div>
</van-form>

</div>
</template>
<script>

import { getAuthorizations } from '@/api/user'
export default {
  name: 'UserPage',
  data () {
    return {
      username: '',
      password: '',
      code: '246810',
      mobile: '13888888888'

    }
  },
  created () {
    this.add()
  },
  methods: {
    async onSubmit (values) {
      console.log('submit', values)
    },
    async add () {
      await getAuthorizations({ mobile: this.mobile, code: this.code })
      console.log(this.username)
    }
  }
}
</script>
<style>

.van-icon-arrow-left{
    padding-left: 10px;
    padding-top: 20px;
    padding-bottom: 20px;
}
.van-ellipsis {
  padding:  20px 10px!important;
  margin:20px !important;
  font-size: 30px !important;
}
.van-field__label span {
  padding-left: 20px;
}
</style>
